fix(rag): update agent to support agent-starter-pack and vertex rag engine deployment#1237
Merged
happyhuman merged 2 commits intogoogle:mainfrom Mar 12, 2026
Merged
Conversation
…ngine deployment * Move grant_permissions.sh to shared_libraries so it survives ASP scaffolding * Add Makefile hooks (setup_corpus, grant_permissions) to natively integrate with ASP `make install` and `make backend` lifecycles * Update prepare_corpus_and_data.py to intelligently load .env from scaffolded cwd and update to 2025 GOOG-10-K URL * Fix agent.py to conditionally load retrieval tool to avoid crash on empty corpus and remove hardcoded location from __init__.py so vertex RAG correctly infers region from the corpus * Update README to reflect 2025 report and new ASP workflow
happyhuman
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updates the RAG agent template to fully support the Agent Garden / Agent Starter Pack deployment lifecycles and fixes several underlying bugs related to Vertex AI Agent Engine and RAG Corpus region routing.
Key Changes
Makefilewithinstallandbackendhooks so that Agent Starter Pack automatically triggers the interactive RAG Corpus generation prompt and the IAM permissions script during scaffolding and deployment.grant_permissions.shout of thedeploymentfolder intorag/shared_librariesso it isn't erased during ASP terraform template overrides.prepare_corpus_and_data.pynow prioritizes reading from thecwd.envfile first so it correctly updates the newly scaffolded project's state.globallocation from__init__.pyand added dynamic region extraction inagent.py. This fixes the400 INVALID_ARGUMENT (RESOURCE_PROJECT_INVALID)error by ensuring the Vertex SDK uses the region where the RAG corpus was actually created (e.g.,us-central1) rather than forcing cross-regional requests.agent.pyto cleanly omit theVertexAiRagRetrievaltool if noRAG_CORPUSID is configured in the environment, preventing startup crashes.2025financial report URL since the 2024 URL is throwing a403 Forbidden.Testing
Validated locally via pure ASP commands:
uvx agent-starter-pack create ... && cd ... && make install && make backend.